#include "vector.h"
#include <string>
namespace mihayou
{
	void test01()
	{
		vector<int> v1;
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);
		v1.push_back(5);
		v1.push_back(6);

		vector<int>::iterator it = v1.begin();
		while (it != v1.end())
		{
			cout << *it << " ";
			it++;
		}
		cout << endl;

		for (auto e : v1)
		{
			cout << e << " ";
		}
		cout << endl;

		print_vector(v1);

		vector<double> v2;
		v2.push_back(1.1);
		v2.push_back(2.2);
		v2.push_back(3.3);
		v2.push_back(4.4);
		v2.push_back(5.5);
		v2.push_back(6.6);
		print_vector(v2);

		cout << v1[1] << endl;
		cout << v2[1] << endl;

		v1.pop_back();
		v2.pop_back();
		print_vector(v1);
		print_vector(v2);

	}

	void test02()
	{
		vector<int> v1;
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);
		//v1.push_back(5);
		print_vector(v1);


		/*v1.insert(v1.begin(), 100);
		print_vector(v1);*/

		auto pos = find(v1.begin(), v1.end(), 2);
		if (pos != v1.end())
		{
			pos = v1.insert(pos, 600);
			*(pos + 1) *= 10;
		}
		print_vector(v1);

	}

	void test03()
	{
		vector<int> v1;
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);
		v1.push_back(4);
		v1.push_back(5);
		print_vector(v1);

		vector<int>::iterator it = v1.begin();
		while(it != v1.end())
		{
			if (*it % 2 == 0)
			{
				v1.erase(it);
			}
			else
			{
				it++;
			}
		}
		print_vector(v1);

	}

	void test04()
	{
		vector<int> v1;
		v1.resize(10, 1);
		print_vector(v1);
		cout << v1.size() << endl;
		cout << v1.capacity() << endl;
		v1.resize(15, 2);
		print_vector(v1);

		v1.resize(55);
		print_vector(v1);

	}

	void test05()
	{
		vector<int> v1;
		v1.resize(5, 2);
		print_vector(v1);

		vector<int> v2(v1);
		print_vector(v2);

		vector<int> v3;
		v3 = v2;
		print_vector(v3);


	}

	void test06()
	{
		vector<int> v1;
		v1.resize(5, 2);
		print_vector(v1);

		vector<int> v2(v1.begin(), v1.begin() + 3);
		print_vector(v2);

		vector<int> v3(10, 6);
		print_vector(v3);

		vector<string> v4(4, "777");
		print_container(v4);
	}

	void test07()
	{
		vector<string> v1;
		v1.push_back("666");
		v1.push_back("666");
		v1.push_back("666");
		v1.push_back("666");
		print_container(v1);

		v1.push_back("666");
		print_container(v1);

	}

}

int main()
{
	mihayou::test07();
	return 0;
}